package com.me.mygdxgame;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.me.ultilities.Constants;
import com.me.ultilities.DrawComponent;
import com.me.ultilities.LoadData;

public class MainMenu implements Screen{
	private Texture backgroundTexture;
	private Texture titleTexture;
	private SpriteBatch spriteBatch;
	private DrawComponent draw;
	private Stage stage;
	private ButtonOfMenu btnExit;
	private ButtonOfMenu btnPlay;
	private ButtonOfMenu btnShop;
	private ButtonOfMenu btnMission;
	private ButtonOfMenu btnMore;
	@Override
	public void render(float delta) {
		// TODO Auto-generated method stub
		Gdx.gl.glClearColor(0, 0, 0, 1);
		Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
		spriteBatch.begin();
		draw.drawPicture(backgroundTexture, spriteBatch, 0, 0, 480, 800);
		draw.drawPicture(titleTexture, spriteBatch, 190, 285, 175, 500);
		spriteBatch.end();
		stage.act(delta);
		stage.draw();
	}

	@Override
	public void resize(int width, int height) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void show() {
		// TODO Auto-generated method stub
		
		stage = new Stage(800,480,true);	
		btnExit = new ButtonOfMenu(710, 400, 70, 70,Constants.EXIT_BUTTON_TYPE);
		btnPlay = new ButtonOfMenu(15, 65, 175, 150, Constants.PLAY_BUTTON_TYPE);
		btnShop = new ButtonOfMenu(210, 40, 175, 150, Constants.SHOP_BUTTON_TYPE);
		btnMission = new ButtonOfMenu(415, 65, 175, 150, Constants.MISSION_BUTTON_TYPE);
		btnMore = new ButtonOfMenu(605, 40, 175, 150, Constants.MORE_BUTTON_TYPE);
		spriteBatch = new SpriteBatch();
		backgroundTexture = LoadData.getTexture(Constants.BACKGROUND);
		titleTexture = LoadData.getTexture(Constants.TITLE);
		draw = new DrawComponent();	
		btnExit.addToStage(stage);
		btnPlay.addToStage(stage);
		btnShop.addToStage(stage);
		btnMission.addToStage(stage);
		btnMore.addToStage(stage);
		Gdx.input.setInputProcessor(stage);
		
	}

	@Override
	public void hide() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void pause() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void resume() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void dispose() {
		// TODO Auto-generated method stub
		
	}

}
